using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Daniel.Core.Models.Mapping
{
    public class VendorMap : EntityTypeConfiguration<Vendor>
    {
        public VendorMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Name)
                .IsRequired()
                .HasMaxLength(400);

            this.Property(t => t.Email)
                .HasMaxLength(400);

            this.Property(t => t.MetaKeywords)
                .HasMaxLength(400);

            this.Property(t => t.MetaTitle)
                .HasMaxLength(400);

            this.Property(t => t.PageSizeOptions)
                .HasMaxLength(200);

            // Table & Column Mappings
            this.ToTable("Vendor");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.Email).HasColumnName("Email");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.AdminComment).HasColumnName("AdminComment");
            this.Property(t => t.Active).HasColumnName("Active");
            this.Property(t => t.Deleted).HasColumnName("Deleted");
            this.Property(t => t.DisplayOrder).HasColumnName("DisplayOrder");
            this.Property(t => t.MetaKeywords).HasColumnName("MetaKeywords");
            this.Property(t => t.MetaDescription).HasColumnName("MetaDescription");
            this.Property(t => t.MetaTitle).HasColumnName("MetaTitle");
            this.Property(t => t.PageSize).HasColumnName("PageSize");
            this.Property(t => t.AllowCustomersToSelectPageSize).HasColumnName("AllowCustomersToSelectPageSize");
            this.Property(t => t.PageSizeOptions).HasColumnName("PageSizeOptions");
        }
    }
}
